<template name="popupWindows_sendTransactionConfirmation">
    <div class="popup-windows tx-info">
        <form action="#">
            {{#with $.Session.get "data"}}
                {{#if $and data (TemplateVar.get "toIsContract")}}
                    <h1>{{i18n "mist.popupWindows.sendTransactionConfirmation.title.contractExecution"}}</h1>
                {{else}}
                    {{#if to}}
                        <h1>{{i18n "mist.popupWindows.sendTransactionConfirmation.title.sendTransaction"}}</h1>
                    {{else}}
                        <h1>{{i18n "mist.popupWindows.sendTransactionConfirmation.title.createContract"}}</h1>
                    {{/if}}
                {{/if}}
            

                <div class="transaction-parties">
                    <div>
                        {{#if TemplateVar.get "fromIsContract"}}
                            <i class="overlap-icon icon-doc"></i>
                        {{else}}
                            <i class="overlap-icon icon-key"></i>
                        {{/if}}
                        {{> dapp_identicon identity=from class="dapp-large"}}
                        <br>
                        <span class="simptip-position-bottom simptip-movable" data-tooltip="{{from}}">{{shortenAddress from}}</span>
                    </div>
                    <div class="amount">
                        {{{totalAmount}}} <span class="unit">ETHER</span>

                        {{#if executionFunction}}
                            <span class="execute-function">{{executionFunction}}</span>
                        {{/if}}
                    </div>
                    <div>
                        {{#if to}}
                            {{#if TemplateVar.get "toIsContract"}}
                                <i class="overlap-icon icon-doc"></i>
                            {{else}}
                                <i class="overlap-icon icon-key"></i>
                            {{/if}}
                            {{> dapp_identicon identity=to class="dapp-large"}}
                            <br>
                            <span class="simptip-position-bottom simptip-movable" data-tooltip="{{to}}">{{shortenAddress to}}</span>
                        {{else}}
                            <i class="circle-icon icon-doc"></i>
                            <br>
                            <span>{{i18n "mist.popupWindows.sendTransactionConfirmation.createContract"}}</span>
                        {{/if}}
                    </div>
                </div>

                {{#if $and data (TemplateVar.get "toIsContract")}}
                    <p class="info">{{{i18n "mist.popupWindows.sendTransactionConfirmation.contractExecutionInfo"}}}</p>
                {{/if}}

                {{#unless to}}
                    <p class="info">{{{i18n "mist.popupWindows.sendTransactionConfirmation.contractCreationInfo"}}}</p>
                {{/unless}}

                <table class="dapp-small">
                    <tbody>
                        <tr>
                            <td>
                                {{i18n "mist.popupWindows.sendTransactionConfirmation.estimatedFee"}} 
                            </td>
                            <td>
                                {{#if $eq (TemplateVar.get "estimatedGas") "invalid"}}
                                    <span class="red"><i class="icon-shield"></i> {{i18n "mist.popupWindows.sendTransactionConfirmation.estimatedGasError"}}</span>
                                {{else}}
                                    {{estimatedFee}} ({{dapp_formatNumber (TemplateVar.get "estimatedGas") "0,0"}} gas)
                                {{/if}}
                            </td>
                        </tr>
                        <tr>
                            <td>
                                {{i18n "mist.popupWindows.sendTransactionConfirmation.gasLimit"}}
                            </td>
                            <td>
                                {{providedGas}} ether (<span class="provided-gas" contenteditable="true">{{dapp_formatNumber (TemplateVar.get 'initialProvidedGas') '0'}}</span> gas)
                            </td>
                        </tr>
                        <tr>
                            <td>
                                {{i18n "mist.popupWindows.sendTransactionConfirmation.gasPrice"}}
                            </td>
                            <td>{{dapp_formatBalance gasPrice "0,0.0[0000]" "szabo"}} {{i18n "mist.popupWindows.sendTransactionConfirmation.perMillionGas"}}</td>
                        </tr>
                    </tbody>
                </table>

                {{#if data}}
                    <div class="data">
                        <p>{{i18n "mist.popupWindows.sendTransactionConfirmation.data"}}</p>
                        <pre>{{{formattedData}}}</pre>
                    </div>
                {{/if}}

            {{/with}}

            {{#if TemplateVar.get "unlocking"}}
                <h2>{{i18n "mist.popupWindows.sendTransactionConfirmation.unlocking"}}</h2>
            {{else}}
                <input type="password" placeholder="{{i18n 'mist.popupWindows.sendTransactionConfirmation.enterPassword'}}">

                <div class="dapp-modal-buttons">
                    <button class="cancel" type="button">{{i18n "buttons.cancel"}}</button>
                    <button class="ok dapp-primary-button" type="submit">{{i18n "mist.popupWindows.sendTransactionConfirmation.buttons.sendTransaction"}}</button>
                </div>
            {{/if}}
        </form>
    </div>
</template>